#include<stdio.h>
int majorityElement(int* nums, int numsSize)
//双重循环
{
	int i, j, count;
	for (i = 0; i < numsSize; i++) {
		count = 0;
		for (j = 0; j < numsSize; j++) {
			if (nums[i] == nums[j])
				count++;
			if (count > numsSize / 2)
				return i;
			//	printf("%d\n", nums[i]);
		}
	}
	return -1;
}

int main()
{
	int nums[] = { 3,2,3 };
	int sz = sizeof(nums) / sizeof(nums[0]);
	int ret = majorityElement(nums, sz);
	if (ret >= 0)
		printf("%d\n", nums[ret]);
	return 0;
}